home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-10-15 | 1.9 KB | 54 lines | [TEXT/MSWD] |
- ==================================================================
- zipCheck HyperCard XFCN
- © Copyright 1988 by Sam Thornton
- ==================================================================
-
- zipCheck checks a zipcode against a list of the 895 valid 3-digit
- zip areas in the 50 states (as of 1/88) and returns the correct
- state abbreviation for the target area.
-
- The zipcode's format must be either 5 TEXT characters (e.g.,
- "68938"), or 10 TEXT characters (e.g., "68938-0123").
-
- If there is either a format error in the entered zipcode, or if
- there is no corresponding 3-digit zip area, zipCheck beeps and
- returns a null string instead of a state abbreviation.
-
- This allows you to either generate correct state abbreviations
- based on an entered zipcode, or crosscheck zipcodes against an
- entered state abbreviation.
- ==================================================================
- Syntax:
-
- get zipCheck(<"zipcode">); or
-
- get zipCheck(<field "fieldname">)
-
- The return is the correct state abbreviation for the entered
- zipcode or, in the case of an error, an empty string.
-
- Sample HyperCard script (for a zipcode entry field):
-
- on closeField
- get zipCheck (bkgnd field "ZipCode")
- if it is not empty then
- put it into bkgnd field "State"
- else
- put empty into bkgnd field "ZipCode"
- answer "Sorry, entered zipcode is invalid..."
- end if
- pass closeField
- end closeField
-
- ==================================================================
-
- Use ResEdit to install zipCheck into any stack. Installing in your
- Home stack will make it available from all other stacks.
-
- ==================================================================
-
- May be copied & distributed without charge only, except for nominal
- copying and distribution costs. Not for commercial sale or resale.
- See the "zipCheck.c" file for source listing.
- ==================================================================
-